//
//  StringWithWidth.m
//  TravelWithYourHeart
//
//  Created by 邹功梁 on 15/9/9.
//  Copyright (c) 2015年 邹功梁. All rights reserved.
//

#import "StringWithWidth.h"

@implementation StringWithWidth

+ (CGFloat)WidthWithText:(NSString *)text height:(CGFloat)height font:(UIFont *)font
{
    CGSize size = CGSizeMake(3000, height);
    CGRect rect = [text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:font} context:nil];
    
    return rect.size.width;
}

@end
